﻿<!DOCTYPE html>
<html lang="zh-CN">

<head>
	<title>WebMVC</title>
</head>

<body style="background-color: #F2F2F2">
	<button  click="click()">登录</button>
	<script>
		var sock = null;
		var wsuri = "ws://192.168.1.166:9004/api";
		sock = new WebSocket(wsuri);
			function wsopen (e) {
				console.log("链接成功");
				click();
			}
			function wsclose (e) {
				console.log("系统断开链接");
			
			}
			function receive (e) {
				var json = JSON.parse(e.data);
				console.log(json);

			}			
			sock.onopen = wsopen;
			sock.onclose = wsclose;
			sock.onmessage = receive;
		
		function click(){
			var cmd={openId:"ssssss"};
			console.log("send")
			sock.send(JSON.stringify(cmd));
		}

	

	</script>
</body>


</html>